#include <iostream>
#include "logger/logger.hpp"
const char* severityName[] = {
    "PANIC",
    "ERROR",
    "WARN",
    "INFO",
    "DEBUG"
};
void TestLog(logger::Severity severity)
{
    std::cout << "Set default severity to " << severityName[static_cast<int>(severity)] << std::endl;
    logger::SetSeverity(severity);
    LOG_DEBUG("This is a debug\n");
    LOG_INFO("This is a info\n");
    LOG_WARN("This is a warn\n");
    LOG_ERROR("This is an error\n");
    LOG_PANIC("This is a panic\n");
}

int main()
{
    getchar();
    TestLog(logger::Severity::DEBUG);
    getchar();
    TestLog(logger::Severity::INFO);
    getchar();
    TestLog(logger::Severity::WARN);
    getchar();
    TestLog(logger::Severity::ERROR);
    getchar();
    TestLog(logger::Severity::PANIC);
    getchar();
    
    std::cout << "Redirect log to file now" << std::endl;
    std::FILE* logFile = std::fopen("./log", "a+");
    logger::Redirect(logFile);
    TestLog(logger::Severity::DEBUG);
    
    return 0;
}